package com.sg.service.biz.bff.impl;

import com.sg.common.util.CommonFunctionHelper;
import com.sg.common.util.RedisUtil;
import com.sg.dto.biz.bff.req.BffImplementIntelligentCommandCommunicationServiceReqDto;
import com.sg.dto.biz.bff.req.BffImplementRecordIdeasReqDto;
import com.sg.dto.biz.bff.req.BffImplementSmartSessionReqDto;
import com.sg.dto.biz.bff.res.BffImplementIntelligentCommandCommunicationServiceRespDto;
import com.sg.dto.biz.bff.res.BffImplementRecordIdeasRespDto;
import com.sg.dto.biz.bff.res.BffImplementSmartSessionRespDto;
import com.sg.dto.integration.app.ImplementIntelligentCommandCommunicationServicesComReqDto;
import com.sg.dto.integration.app.ImplementIntelligentCommandCommunicationServicesComRespDto;
import com.sg.dto.integration.app.ImplementRecordIdeasComReqDto;
import com.sg.dto.integration.app.ImplementRecordIdeasComRespDto;
import com.sg.service.biz.bff.IntelligentCommunicationService;
import com.wicket.okrapp.integration.IntelligentCommunicationService;
import com.sg.common.exception.Assert;
import com.wicket.okrcomponent.integration.IntelligentCommunicationService;
import org.apache.skywalking.apm.toolkit.trace.Tag;
import org.apache.skywalking.apm.toolkit.trace.Tags;
import org.apache.skywalking.apm.toolkit.trace.Trace;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @author ：
 * @version 1.0
 * @date ：
 */
@Service
public class IntelligentCommunicationServiceImpl implements IntelligentCommunicationService {

    @Resource
    private RedisUtil redisUtil;
    @Resource
    com.sg.service.biz.component.IntelligentCommunicationService fwCompIntelligentCommunicationClient;
    @Resource
    com.sg.service.biz.app.IntelligentCommunicationService fwAppIntelligentCommunicationClient;

    /**
     * B2执行智能指令沟通服务[8124]
     * gen by moon at 12/11/2023, 3:35:27 PM
     */
    @Trace(operationName = "B2执行智能指令沟通服务")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    public BffImplementIntelligentCommandCommunicationServiceRespDto implementIntelligentCommandCommunicationService(BffImplementIntelligentCommandCommunicationServiceReqDto reqDto) {


        ImplementIntelligentCommandCommunicationServicesComRespDto implementIntelligentCommandCommunicationServicesComRespDto_1 = null;
//步骤0: D3执行智能指令沟通服务(公共) - implementIntelligentCommandCommunicationServicesCom
        ImplementIntelligentCommandCommunicationServicesComRespDto implementIntelligentCommandCommunicationServicesComRespDto = null;
        ImplementIntelligentCommandCommunicationServicesComReqDto implementIntelligentCommandCommunicationServicesComReqDto = new ImplementIntelligentCommandCommunicationServicesComReqDto();
        if (reqDto != null) {
            implementIntelligentCommandCommunicationServicesComReqDto.setAppId(reqDto.getAppId());//SimpleFieldAssign//sourceId:1404772_1
            implementIntelligentCommandCommunicationServicesComReqDto.setApiKey(reqDto.getApiKey());//SimpleFieldAssign//sourceId:1404773_1
            implementIntelligentCommandCommunicationServicesComReqDto.setApiSecret(reqDto.getApiSecret());//SimpleFieldAssign//sourceId:1404774_1
            implementIntelligentCommandCommunicationServicesComReqDto.setContent(reqDto.getContent());//SimpleFieldAssign//sourceId:1404775_1
            implementIntelligentCommandCommunicationServicesComReqDto.setSn(reqDto.getSn());//SimpleFieldAssign//sourceId:1404776_1
        }

        /*D3执行智能指令沟通服务(公共)[8102]   */
        Assert.isNull(implementIntelligentCommandCommunicationServicesComReqDto.getAppId(), "B2执行智能指令沟通服务-D3执行智能指令沟通服务(公共)-应用ID不能为空", false);
        Assert.isNull(implementIntelligentCommandCommunicationServicesComReqDto.getApiKey(), "B2执行智能指令沟通服务-D3执行智能指令沟通服务(公共)-应用key不能为空", false);
        Assert.isNull(implementIntelligentCommandCommunicationServicesComReqDto.getApiSecret(), "B2执行智能指令沟通服务-D3执行智能指令沟通服务(公共)-应用密码不能为空", false);
        Assert.isNull(implementIntelligentCommandCommunicationServicesComReqDto.getContent(), "B2执行智能指令沟通服务-D3执行智能指令沟通服务(公共)-消息内容不能为空", false);
        Assert.isNull(implementIntelligentCommandCommunicationServicesComReqDto.getSn(), "B2执行智能指令沟通服务-D3执行智能指令沟通服务(公共)-设备号不能为空", false);
        implementIntelligentCommandCommunicationServicesComRespDto = fwAppIntelligentCommunicationClient.implementIntelligentCommandCommunicationServicesCom(implementIntelligentCommandCommunicationServicesComReqDto).getData()/*vcase invoke 跨dubbo调用;*/;


        implementIntelligentCommandCommunicationServicesComRespDto_1 = implementIntelligentCommandCommunicationServicesComRespDto;

        BffImplementIntelligentCommandCommunicationServiceRespDto retData = new BffImplementIntelligentCommandCommunicationServiceRespDto();
        if (implementIntelligentCommandCommunicationServicesComRespDto_1 != null) {
            retData.setContent(implementIntelligentCommandCommunicationServicesComRespDto_1.getContent());//SimpleFieldAssign//sourceId:1404757_1
        }


        return retData;
    }

    /**
     * B3执行智能沟通服务[8124]
     * gen by moon at 12/12/2023, 7:43:50 PM
     */
    @Trace(operationName = "B3执行智能沟通服务")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    public BffImplementSmartSessionRespDto implementSmartSession(BffImplementSmartSessionReqDto reqDto) {


        ImplementIntelligentCommandCommunicationServicesComRespDto implementIntelligentCommandCommunicationServicesComRespDto_1 = null;
//步骤0: D3执行智能指令沟通服务(公共) - implementIntelligentCommandCommunicationServicesCom
        ImplementIntelligentCommandCommunicationServicesComRespDto implementIntelligentCommandCommunicationServicesComRespDto = null;
        ImplementIntelligentCommandCommunicationServicesComReqDto implementIntelligentCommandCommunicationServicesComReqDto = new ImplementIntelligentCommandCommunicationServicesComReqDto();
        if (reqDto != null) {
            implementIntelligentCommandCommunicationServicesComReqDto.setAppId(reqDto.getAppId());//SimpleFieldAssign//sourceId:1404772_1
            implementIntelligentCommandCommunicationServicesComReqDto.setApiKey(reqDto.getApiKey());//SimpleFieldAssign//sourceId:1404773_1
            implementIntelligentCommandCommunicationServicesComReqDto.setApiSecret(reqDto.getApiSecret());//SimpleFieldAssign//sourceId:1404774_1
            implementIntelligentCommandCommunicationServicesComReqDto.setContent(reqDto.getContent());//SimpleFieldAssign//sourceId:1404775_1
            implementIntelligentCommandCommunicationServicesComReqDto.setSn(reqDto.getSn());//SimpleFieldAssign//sourceId:1404776_1
        }

        /*D3执行智能指令沟通服务(公共)[8102]   */
        Assert.isNull(implementIntelligentCommandCommunicationServicesComReqDto.getAppId(), "B3执行智能沟通服务-D3执行智能指令沟通服务(公共)-应用ID不能为空", false);
        Assert.isNull(implementIntelligentCommandCommunicationServicesComReqDto.getApiKey(), "B3执行智能沟通服务-D3执行智能指令沟通服务(公共)-应用key不能为空", false);
        Assert.isNull(implementIntelligentCommandCommunicationServicesComReqDto.getApiSecret(), "B3执行智能沟通服务-D3执行智能指令沟通服务(公共)-应用密码不能为空", false);
        Assert.isNull(implementIntelligentCommandCommunicationServicesComReqDto.getContent(), "B3执行智能沟通服务-D3执行智能指令沟通服务(公共)-消息内容不能为空", false);
        implementIntelligentCommandCommunicationServicesComRespDto = fwAppIntelligentCommunicationClient.implementIntelligentCommandCommunicationServicesCom(implementIntelligentCommandCommunicationServicesComReqDto).getData()/*vcase invoke 跨dubbo调用;*/;


        implementIntelligentCommandCommunicationServicesComRespDto_1 = implementIntelligentCommandCommunicationServicesComRespDto;

        BffImplementSmartSessionRespDto retData = new BffImplementSmartSessionRespDto();
        if (implementIntelligentCommandCommunicationServicesComRespDto_1 != null) {
            retData.setContent(implementIntelligentCommandCommunicationServicesComRespDto_1.getContent());//SimpleFieldAssign//sourceId:1404757_1
        }


        return retData;
    }

    /**
     * B3执行记录想法[8317]
     * gen by moon at 1/21/2024, 8:20:03 PM
     */
    @Trace(operationName = "B3执行记录想法")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    public BffImplementRecordIdeasRespDto implementRecordIdeas(BffImplementRecordIdeasReqDto reqDto) {


        //步骤0: D3执行记录想法(公共) - implementRecordIdeasCom
        ImplementRecordIdeasComRespDto implementRecordIdeasComRespDto = null;
        ImplementRecordIdeasComReqDto implementRecordIdeasComReqDto = new ImplementRecordIdeasComReqDto();
        implementRecordIdeasComReqDto.setOriginalRoleMemberId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecOriginalRoleMemberId());//CURRENT_ORIGINAL_ROLE_MEMBERID//sourceId:1494114_1
        implementRecordIdeasComReqDto.setUserId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecUserId());//CURRENT_USERID//sourceId:1494115_1
        implementRecordIdeasComReqDto.setCreateInductionId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecInductionRecordId());//CURRENT_INDUCTIONID//sourceId:1494119_1
        implementRecordIdeasComReqDto.setSpaceId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecSpaceId());//CURRENT_SPACEID//sourceId:1494116_1
        implementRecordIdeasComReqDto.setAppId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecAppId());//CURRENT_APPID//sourceId:1494117_1
        if (reqDto != null) {
            implementRecordIdeasComReqDto.setContent(reqDto.getContent());//SimpleFieldAssign//sourceId:1494118_1
            implementRecordIdeasComReqDto.setCustomField(reqDto.getCustomField());//SimpleFieldAssign//sourceId:1494122_1
        }

        /*D3执行记录想法(公共)[8289]   */
        Assert.isNull(implementRecordIdeasComReqDto.getContent(), "B3执行记录想法-D3执行记录想法(公共)-消息内容不能为空", false);
        Assert.isNull(implementRecordIdeasComReqDto.getCustomField(), "B3执行记录想法-D3执行记录想法(公共)-自定义字段不能为空", false);
        Assert.isNull(implementRecordIdeasComReqDto.getOriginalRoleMemberId(), "B3执行记录想法-D3执行记录想法(公共)-身份人员ID不能为空", false);
        Assert.isNull(implementRecordIdeasComReqDto.getUserId(), "B3执行记录想法-D3执行记录想法(公共)-账号ID不能为空", false);
        Assert.isNull(implementRecordIdeasComReqDto.getCreateInductionId(), "B3执行记录想法-D3执行记录想法(公共)-创建人就职记录ID不能为空", false);
        Assert.isNull(implementRecordIdeasComReqDto.getSpaceId(), "B3执行记录想法-D3执行记录想法(公共)-创建于空间ID不能为空", false);
        Assert.isNull(implementRecordIdeasComReqDto.getAppId(), "B3执行记录想法-D3执行记录想法(公共)-创建于联盟应用ID不能为空", false);
        implementRecordIdeasComRespDto = fwAppIntelligentCommunicationClient.implementRecordIdeasCom(implementRecordIdeasComReqDto).getData()/*vcase invoke 跨dubbo调用;*/;


        BffImplementRecordIdeasRespDto retData = new BffImplementRecordIdeasRespDto();


        return retData;
    }
    //
}
